package ren.kane.phoenix.thread;

/**
 * @author renrk(1275) on 2019-08-15 11:23 AM
 **/
public class JoinTest {

    static class ThreadA extends Thread {
        public ThreadA(String name) {
            super(name);
        }

        @Override
        public void run() {
            System.out.printf("%s start\n", this.getName());
            // 延时操作
            for (int i = 0; i < 1000000; i++)
                ;
            System.out.printf("%s finish\n", this.getName());
        }
    }

    public static void main(String[] args) {
        try {
            Thread t = new ThreadA("t");
            t.start();
            t.join();
            System.out.printf("%s finish\n", Thread.currentThread().getName());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
